<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'testJSTL.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
    	Map<String,String> map=new HashMap<>();
    	map.put("zuigao","许鹏");
    	map.put("zuishuai","华强");
    	map.put("zuishou","wangming");
    	request.setAttribute("java61", map);
       request.setAttribute("ar", new String[]{"许鹏","徐明浩","蒋伟","丁鹏飞"});
    	request.setAttribute("str", "<script>alert('123');</script>");
     %>
     <c:out value="${str}"></c:out>
     <c:set var="age" value="83"></c:set>
     <c:if test="${age>=18}">成年人</c:if>
     <h1>
     <c:choose>
     	<c:when test="${age>=60}">老年人</c:when>
     	<c:when test="${age>=45}">中年人</c:when>
     	<c:when test="${age>=18}">成年人</c:when>
     	<c:otherwise>未成年人</c:otherwise>
     </c:choose>
     </h1>
     <ul>
       <c:forEach items="${ar}" var="d">
        <li>${d}</li>
       </c:forEach>
     </ul>
     <h1>
     	最帅：${java61.zuishuai}，最高:${java61['zuigao']}
     </h1>
     <!-- 循环map的特别之处 ,e是一组键值对-->
     <c:forEach items="${java61}" var="e">
     	${e.key}=${e.value}<br/>
     </c:forEach>
     <hr/>
     <!-- 1-到40 -->
     <c:forEach begin="1" end="40" var="i">
        ${i}&nbsp;&nbsp;
     </c:forEach>
  </body>
</html>
